package gui;

import java.awt.Dimension;
import java.sql.SQLException;
import java.util.ResourceBundle;
import javax.swing.JLabel;
import javax.swing.JTextPane;
import javax.swing.SwingConstants;


public class VoetafdrukResultaat extends javax.swing.JPanel {
	
	private double resultaat;
	private JLabel lblResultaat, lblTitelTips;
	private JTextPane jtpCommentaar, jtpTips;
	private ResourceBundle bundle;
	
	public VoetafdrukResultaat(double resultaat, ResourceBundle bundle) throws IllegalStateException, SQLException, ClassNotFoundException {
		super();
		this.resultaat = resultaat;
		this.jtpCommentaar = new JTextPane();
		this.jtpTips = new JTextPane();
		this.bundle = bundle;
		initGUI();
	}
	
	private void initGUI() {
		try {
			this.setLayout(null);
			
			lblResultaat = new JLabel();
			lblTitelTips = new JLabel();
			
			this.add(lblResultaat);
			lblResultaat.setText(Double.toString(resultaat) + " ha");
			lblResultaat.setBounds(0, 30, 600, 50);
			lblResultaat.setForeground(new java.awt.Color(255,255,255));
			lblResultaat.setFont(new java.awt.Font("Dialog",1,30));
			lblResultaat.setHorizontalAlignment(SwingConstants.CENTER);
			
			if(resultaat > 0 && resultaat < 4)
				jtpCommentaar.setText(bundle.getString("resultaat_goed"));
			if(resultaat >= 4 && resultaat < 7)
				jtpCommentaar.setText(bundle.getString("resultaat_normaal"));
			if(resultaat >= 7)
				jtpCommentaar.setText(bundle.getString("resultaat_slecht"));
			
			this.add(jtpCommentaar);
			jtpCommentaar.setBounds(30, 100, 540, 50);
			jtpCommentaar.setForeground(new java.awt.Color(255,255,255));
			jtpCommentaar.setBackground(null);
			
			this.add(lblTitelTips);
			lblTitelTips.setText(bundle.getString("tips_titel"));
			lblTitelTips.setBounds(30, 140, 300, 30);
			lblTitelTips.setForeground(new java.awt.Color(255,255,255));
			lblTitelTips.setFont(new java.awt.Font("Dialog",1,12));
			
			this.add(jtpTips);
			jtpTips.setText(bundle.getString("tips"));
			jtpTips.setBounds(30, 170, 540, 140);
			jtpTips.setForeground(new java.awt.Color(255,255,255));
			jtpTips.setBackground(null);
	
			this.setPreferredSize(new Dimension(550,370));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
